package com.ljm.boot.rabbitmq.comsumer;

import com.ljm.boot.rabbitmq.constant.*;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * 消息接收者
 */
@Service
public class HeadersConsumer {

    @RabbitListener(queues = RabbitMQConstant.HEADER_QUEUE_1)
    public void queue_header1(Message message) {
        System.out.println("queue_header01 接收消息 message 对象" + message);
        System.out.println("queue_header01 接收消息" + new String(message.getBody()));
    }

    @RabbitListener(queues = RabbitMQConstant.HEADER_QUEUE_2)
    public void queue_header2(Message message) {
        System.out.println("queue_header2 接收消息 message 对象" + message);
        System.out.println("queue_header2 接收消息" + new String(message.getBody()));
    }
}
